<script setup>
import { useTheme } from '@/hooks/useTheme'
import { useLocaleStore, usePermissionStore } from '@/store'
import { $t } from '@/languages/index'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'
const { initTheme } = useTheme()
const localeStore = useLocaleStore()
const permissionStore = usePermissionStore()
const lang = computed(() => (localeStore.locale === 'zh' ? zhCn : en))

/** 初始化主题 */
initTheme()
/** 初始化语言 */
localeStore.setLocaleAction('en')
/** 初始化路由标题 */
permissionStore.setRouterTitle(permissionStore.routes, $t)
</script>

<template>
  <el-config-provider :locale="lang">
    <router-view />
  </el-config-provider>
</template>
